<?php

include_once($_SERVER['DOCUMENT_ROOT'] . '/htqlmba/configs/Database.php');

class NSX extends Database {

    private $MA_NSX;
    private $TEN_NSX;
    private $TEN_NUOC;

    public function setMA_NSX($MA_NSX) {
        $this->MA_NSX = $MA_NSX;
    }

    public function getMA_NSX() {
        return $this->MA_NSX;
    }

    public function setTEN_NSX($TEN_NSX) {
        $this->TEN_NSX = $TEN_NSX;
    }

    public function getTEN_NSX() {
        return $this->TEN_NSX;
    }

    public function setTEN_NUOC($TEN_NUOC) {
        $this->TEN_NUOC = $TEN_NUOC;
    }

    public function getTEN_NUOC() {
        return $this->TEN_NUOC;
    }

    // function them tram

    public function themnsx() {
        $query = "insert into nha_sx(MA_NSX,TEN_NSX,TEN_NUOC) 
            values ('" . $this->getMA_NSX() . "','" . $this->getTEN_NSX() . "','" . $this->getTEN_NUOC() . "')";
        $this->setQuery($query);
        return $this->executeQuery();
    }

    public function suansx() {

        $query = "	update nha_sx 
						set MA_NSX='" . $this->getMA_NSX() . "',
						TEN_NSX='" . $this->getTEN_NSX() . "',
						TEN_NUOC='" . $this->getTEN_NUOC() . "'
						where MA_NSX='" . $this->getMA_NSX() . "' ";
        $this->setQuery($query);
        return $this->executeQuery();
    }

    public function xoansx() {
        $this->setQuery("delete from nha_sx where  MA_NSX='" . $this->getMA_NSX() . "'");
        return $this->executeQuery();
    }

    public function dsNSX() {
        $this->setQuery("select MA_NSX,TEN_NSX,TEN_NUOC
							 from nha_sx
ORDER BY MA_NSX DESC
							 ");
        return $this->fetchAll();
    }

}

?>